home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-01-06 | 1.3 KB | 60 lines | [TEXT/MMCC] |
- //
- // CTCPSessionDoc.cp
- //
- // TurboTCP library
- // TCP session document
- // TCL-specific class
- //
- // Copyright © 1993-95, FrostByte Design / Eric Scouten
- //
-
- #include "CTCPSessionDoc.h"
-
- #if !TurboTCP_TCL
- #error: This file should be used with TCL projects only!
- #endif
-
-
- // -- closing windows & sessions --
-
- //***********************************************************
-
- Boolean CTCPSessionDoc::Close
- (Boolean quitting) // true if the application is quitting
-
- // Respond to user close. Ensure that the TCP stream is gracefully closed. (This method is
- // also called if the remote host closes the session or the session is terminated.)
-
- // Returns false if close/quit aborted by user.
-
- {
- closeAndQuit = quitting; // do we really want to close?
- if (!ConfirmClose(quitting))
- return false;
-
- if (itsFile) // close file first
- itsFile->Close();
-
- if (!LocalClose(quitting)) // now close stream
- return false;
-
- return CDirector::Close(quitting);
-
- }
-
-
- //***********************************************************
-
- void CTCPSessionDoc::RemoteClose()
-
- // Respond to notification that the remote host cancelled the session (either by normal
- // close or terminate).
-
- {
- Boolean sessionWasEstablished = SessionEstablished();
-
- CTCPEndpoint::RemoteClose();
- if ((goAwayOnClose) && (!sessionWasEstablished))
- Close(false);
- }
-